package com.nineclock.common.exception;

import com.nineclock.common.entity.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class BaseExceptionHandler {


    @ExceptionHandler(value = NcException.class)
    public Result exceptNcExcption(NcException e){
        e.printStackTrace();
        return Result.errorCodeMessage(e.getCode(),e.getMessage());
    }

    @ExceptionHandler(value = Exception.class)
    public Result except(Exception e){
        e.printStackTrace();
        return Result.errorMessage("服务内部错误");
    }
}
